﻿using System.Collections.ObjectModel;
using System.Linq;

namespace Xc.Logics.CodeReaders.Extensions
{
    public static class ObservableCollectionExtension
    {
        public static ObservableCollection<T> TryAdd<T>(this ObservableCollection<T> ts, T obj)
        {
            var da = ts.Where(p => p.GetType().Name == obj.GetType().Name).FirstOrDefault();
            if (da == null)
            {
                ts.Add(obj);
            }
            return ts;
        }
    }
}
